<template>
    <view class="globe_back">
        <view class="maxtitle">申诉中，请如实填写</view>
        <view class="back_fff list">
            <view class="flex justify_content_between pt_24">
                <view class="round" style="background: #f7faff; color: #3377ff">车</view>
                <view class="title">上门检修故障</view>
            </view>
            <view class="flex justify_content_between pt_24">
                <view class="round" style="background: #f7faff; color: #3377ff">目</view>
                <view class="title">
                    <view class="address">贵阳市南明区花果园金融街一号老凤祥贵阳市南明区花果园金融</view>
                    <view>
                        <text class="name">王先生</text>
                        <text class="iphone">156****5412</text>
                    </view>
                </view>
            </view>
        </view>
        <u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></u-picker>
        <!-- 申诉原因 -->
        <view class="flex store justify_content_between f_28" @click="reasonShow">
            <view>申诉原因</view>
            <view class="flex">
                <input type="text" style="text-align: right" disabled placeholder="请选择申诉原因" v-model="reason" />
                <u-icon name="arrow-right"></u-icon>
            </view>
        </view>
        <!-- 描述凭证 -->
        <view class="store">
            <view class="f_28">描述凭证</view>
            <textarea class="f_28" name="" id="" cols="30" rows="10" placeholder="在这里输入您的描述"></textarea>
            <view>
                <view class="flex flex-wrap">
                    <view v-if="images.length > 0" v-for="(item, i) in images">
                        <image class="storeImg" :src="item" mode="widthFix"></image>
                        <view class="imm_delete" @click="deletephotos(i)">
                            <image class="icon_ljt" :src="url + 'icon_sc.png'"></image>
                        </view>
                    </view>
                    <view class="img_add" style="display: inline-block" v-if="images.length < maxImagesNum" @click="instoreImages">
                        <image :src="url + 'updata-img.png'" mode="" style="width: 100%; height: 100%"></image>
                    </view>
                </view>
            </view>
        </view>
        <view class="addBtn" @click="submit">提交申诉</view>
    </view>
</template>

<script>
import { common } from '@/common/serve.js';
export default {
    data() {
        return {
            url: '',
            show: false,
            maxImagesNum: 6,
            images: [],
            starIndex: 0,
            starIndex1: 0,
            columns: [['原因1', '原因', '原因']],
            reason: ''
        };
    },
    onLoad(e) {
        this.type = e.type;
        this.init();
    },
    onShow() {
        this.url = this.baseUrl + this.imgPath;
    },
    methods: {
        submit() {
            uni.navigateTo({
                url: '/pages/OrderReceiverTerminal/DeliverymanOrder/InAppeal'
            });
        },
        reasonShow() {
            this.show = true;
        },
        confirm(e) {
            console.log(e);
            this.reason = e.value[0];
            this.show = false;
        },
        cancel() {
            this.show = false;
        },
        // 删除现场照片
        deletephotos(i) {
            this.images.splice(i, 1);
        },
        // 现场照片
        async instoreImages() {
            let images = this.images;
            let num = this.maxImagesNum - images.length; //图片长度

            const result = await common.chooseImage(num).catch((err) => console.log('chooseImageErrMsg:', err));
            const suceessList = (result || []).filter((item) => item.isSuccess === true);
            if (suceessList.length > 0) {
                suceessList.map((item) => {
                    images.push(item.path);
                });

                this.images = images;
            }
        }
    }
};
</script>

<style scoped lang="scss">
.mapW {
    width: 100%;
    min-height: 40vh;
}
.img_add {
    width: 140rpx;
    height: 140rpx;
}
.maxtitle {
    font-size: 40rpx;
    font-weight: bold;
    padding: 24rpx 32rpx;
}
.phoneBtn {
    width: 230rpx;
    height: 100rpx;
    line-height: 100rpx;
    background: #f7f7f7;
    border-radius: 16rpx;
    margin-top: 24rpx;
    margin-right: 24rpx;
    vertical-align: middle;
    text-align: center;
    display: inline-block;
}
.icon_dh {
    width: 28rpx;
    height: 28rpx;
    margin-right: 12rpx;
}
.addBtn {
    width: 686rpx;
    height: 100rpx;
    line-height: 100rpx;
    text-align: center;
    margin: 24px auto;
    position: fixed;
    bottom: 80rpx;
    left: 50%;
    margin-left: -343rpx;
    background: #3377ff;
    border-radius: 24rpx;
    color: white;
}
.reBtn {
    width: 686rpx;
    height: 100rpx;
    background: #3377ff;
    box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(51, 119, 255, 0.05);
    border-radius: 24rpx 24rpx 24rpx 24rpx;
    color: #ffffff;
    line-height: 100rpx;
    text-align: center;
    margin: 24rpx auto;
}
.cover-box {
    margin-top: 160rpx;
    padding: 0 32rpx;
    .log-1 {
        width: 16rpx;
        height: 16rpx;
        border-radius: 16rpx;
        background-color: #3377ff;
    }
    .log-line {
        width: 2rpx;
        height: 40rpx;
        background-color: #ccced1;
        margin: 10rpx 0;
    }
    .log-2 {
        width: 16rpx;
        height: 16rpx;
        border-radius: 16rpx;
        background-color: #ff6401;
    }
}
.next-icon {
    position: fixed;
    left: 32rpx;
    top: 100rpx;
}
.list {
    padding: 24rpx;
    border-radius: 24rpx;
    margin: 24rpx 32rpx;
    .round {
        width: 40rpx;
        height: 40rpx;
        border-radius: 16rpx;
        background: #00091a;
        font-size: 28rpx;
        color: white;
        text-align: center;
        line-height: 40rpx;
    }
    .type {
        color: #3377ff;
        font-weight: bold;
    }
    .time {
        color: #ccced1;
    }
    .title {
        width: 90%;
        color: #00091a;
        font-size: 32rpx;
        font-weight: bold;
    }
    .address {
        display: inline-block;
        white-space: nowrap;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .name {
        font-weight: normal;
        color: #333a47;
        margin-right: 24rpx;
    }
    .iphone {
        font-weight: normal;
        color: #999ca3;
    }
    .money {
        text-align: right;
        color: #666b75;
    }
    .money text {
        color: #ff6401;
        font-weight: bold;
        font-size: 32rpx;
    }
    .btn {
        text-align: right;
    }
    .cance {
        width: 160rpx;
        height: 68rpx;
        line-height: 68rpx;
        border-radius: 8rpx;
        color: #666b75;
        text-align: center;
        border: 2rpx solid #ccced1;
        margin-top: 24rpx;
    }
    .buy {
        width: 160rpx;
        height: 68rpx;
        line-height: 68rpx;
        border-radius: 8rpx;
        color: #ffffff;
        text-align: center;
        background: #3377ff;
        margin-left: 24rpx;
        margin-top: 24rpx;
    }
}
.title {
    font-size: 28rpx;
    color: #333a47;
}
.infoimg {
    width: 140rpx;
    height: 140rpx;
    border-radius: 16rpx;
    margin: 24rpx 12rpx;
}
.store {
    padding: 24rpx;
    background: white;
    border-radius: 24rpx;
    margin: 0 32rpx 24rpx;
}
.storeImg {
    width: 96rpx;
    height: 96rpx;
    border-radius: 16rpx;
    margin-right: 16rpx;
}
.storeTitle {
    color: #00091a;
    font-size: 32rpx;
    margin-bottom: 8rpx;
}
.address {
    width: 48rpx;
    height: 48rpx;
    display: block;
    margin: 0 auto;
}
.addressText {
    color: #999ca3;
    font-size: 24rpx;
}
.salesVolume {
    color: #999ca3;
    font-size: 28rpx;
}
.detailed {
    color: #333a47;
    font-size: 28rpx;
    margin-bottom: 32rpx;
}
</style>
